/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.basis.swt.element.steuer.rollbar.gruppe;

import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

import de.mnit.basis.swt.element.steuer.rollbar.A_SWT_Rollbar;
import de.mnit.basis.sys.Ausgabe;

/**
 * @author Michael Nitsche
 */
public abstract class A_SWT_Gruppe<TA extends A_SWT_Gruppe<?,?>,TB extends Composite> extends A_SWT_Rollbar<TA,TB> {

	private FormLayout layout=null;


	public void zeigStruktur() {
		iStruktur("",swt());
	}

	public FormLayout gLayout() {
		return this.layout;
	}

	// ERZEUGEN

	protected final int style4() {
		return style5();
	}

	protected final void init4() {
		init5();
	}

	protected abstract int style5();
	protected abstract void init5();

	// INTERN

	private String iStruktur(String pfad,Composite c) {
		String t=pfad+"/"+c;
		Ausgabe.text(t);
		if(pfad.length()>500)
			return "";
		Control[] cc=c.getChildren();
		for(Control ccc : cc)
			if(ccc instanceof Composite)
				iStruktur(t,(Composite)ccc);
			else
				Ausgabe.text(pfad+"/"+ccc.toString());
		return pfad;
	}

}
